package com.nas.crocus.convert;

import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;

public class CustomMappingJacksonHttpMessageConverter extends MappingJacksonHttpMessageConverter {
    
    private static final Logger logger = LoggerFactory.getLogger(CustomMappingJacksonHttpMessageConverter.class);
    
    public CustomMappingJacksonHttpMessageConverter() {
        super();
        logger.debug("construyendo!!!");
        ObjectMapper objectMapper = new ObjectMapper();
        DeserializationConfig deserializationConfig = objectMapper.getDeserializationConfig();
        deserializationConfig.set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        objectMapper.setDeserializationConfig(deserializationConfig);
        this.setObjectMapper(objectMapper);        
    }
}
